﻿using System;
using System.ComponentModel.DataAnnotations;

namespace IFDB.Models.Tables
{
    public class TeamName
    {
        public TeamName()
        {
        }

        [Key]
        public Guid TeamNameId { get; set; }

        public Guid TeamId { get; set; }

        [StringLength(50)]
        public string Name { get; set; }

        public DateTime StartDate { get; set; }
        public DateTime EndDate { get; set; }

        public static TeamName CreateNew(string name, Guid teamId, DateTime startDate, DateTime endDate)
        {
            return new TeamName()
            {
                TeamNameId = Guid.NewGuid(),
                TeamId = teamId,
                Name = name,
                StartDate = startDate,
                EndDate = endDate
            };
        }

        public static TeamName Update(TeamName teamName, Guid teamId, string name, DateTime startDate, DateTime endDate)
        {
            teamName.Name = name;
            teamName.TeamId = teamId;
            teamName.StartDate = startDate;
            teamName.EndDate = endDate;

            return teamName;
        }
    }
}
